<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>任务列表</title>
    <style>
        table {
            width: 100%;
            border-collapse: collapse;
        }
        th, td {
            border: 1px solid #ddd;
            padding: 8px;
        }
        th {
            background-color: #f2f2f2;
            text-align: left;
        }
        tr:nth-child(even) {
            background-color: #f9f9f9;
        }
        tr:hover {
            background-color: #ddd;
        }
    </style>
</head>
<body>
    <h1>任务列表</h1>
    <table>
        <thead>
            <tr>
                <th>任务名称</th>
                <th>机构</th>
                <th>发射时间</th>
                <th>UTC 发射时间</th>
                <th>是否推荐</th>
                <th>状态</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
            {% for mission in missions %}
                <tr>
                    <td>{{ mission.mission_name }}</td>
                    <td>{{ mission.institution }}</td>
                    <td>{{ mission.launch_time }}</td>
                    <td>{{ mission.launch_time_utc }}</td>
                    <td>{{ mission.recommend }}</td>
                    <td>{{ mission.status }}</td>
                    <td>
                        <a href="{% url 'mission_edit' mission.pk %}">编辑</a>|
                        <a href="{% url 'mission_copy' mission.pk %}" onclick="return confirm('确定要复制此任务吗？');">复制</a>
                        <form action="{% url 'mission_delete' mission.pk %}" method="post" style="display:inline;">
                            {% csrf_token %}
                            <button type="submit" onclick="return confirm('确定要删除此任务吗？');" style="background:none;border:none;color:red;cursor:pointer;">删除</button>
                        </form>
                    </td>
                </tr>
            {% empty %}
                <tr>
                    <td colspan="6">暂未添加任务</td>
                </tr>
            {% endfor %}
        </tbody>
    </table>
    <br>
    <a href="{% url 'mission_create' %}">创建新任务</a>
</body>
</html>